package cn.ljy.mes.model;

import cn.ljy.common.model.BaseModel;
import cn.ljy.common.model.validate.AddWorkValidation;
import cn.ljy.common.model.validate.UpdateWorkValidation;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@ApiModel(value = "车型配置")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false, of = {"id"})
public class MesCarModelConfig extends BaseModel {

    @NotNull(groups = UpdateWorkValidation.class, message = "配置ID不能为空")
    private String id;

    @NotNull(groups = AddWorkValidation.class, message = "关联车型不能为空")
    private MesCarModel carModel; // 关联的车型

    @NotBlank(message = "配置名称不能为空")
    @Length(min = 1, max = 50, message = "配置名称长度必须在 {min} - {max} 之间")
    private String name; // 配置名称(如豪华版、尊贵版)

    @NotBlank(groups = AddWorkValidation.class, message = "配置代码不能为空")
    @Length(min = 1, max = 50, message = "配置代码长度必须在 {min} - {max} 之间")
    private String code; // 配置代码(唯一标识)
    @NotNull(groups = AddWorkValidation.class,message="停产状态不能为空")
    private Boolean stopProduction;//是否停产，true表示停产
    @Length(max = 255, message = "描述长度不能超过 {max}")
    private String description; // 配置描述

    @NotNull(groups = UpdateWorkValidation.class, message = "启用状态不能为空")
    private Boolean enabled; // 是否启用

    // 非数据库字段
    private Integer technologyNumber; // 关联的工艺数量

    public MesCarModelConfig(String id) {
        this.id = id;
    }
}